package in.freshstart.java.training.arrays;

public class SearchTest {
	public static void main(String[] args) {

		int[] a = { 1, 7, 3, 4, 5, 6 };
		System.out.println("Array before sorting ");
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i] + "\t");
		}
		System.out.println();
		ArrayExerBubbleSort o1 = new ArrayExerBubbleSort();
		int[] b = o1.bubbleSort(a);
		int k = b.length;
		System.out.println("Array after Sorting");
		for (int j = 0; j < k; j++) {
			System.out.print(b[j] + "\t");
		}
		BinarySearch b1 = new BinarySearch();
		int searchElement = 5;
		int elementFoundAt = b1.binarySearch(b, b.length, searchElement);
		System.out.println("\n\nThis is Binary search");
		System.out.println("Search element " + searchElement);
		System.out.println("Searching Element is found at: "
				+ (elementFoundAt + 1) + "th Location");
		System.out.println("U have Given Search element as "
				+ b[elementFoundAt]);

		LinearSearch l1 = new LinearSearch();
		elementFoundAt = l1.linearSearch(b, 0, b.length, 5);
		System.out.println("\n\nThis is Linear Search");
		System.out.println("Search element" + searchElement);
		System.out.println("Searching Element is found at: "
				+ (elementFoundAt + 1) + "th Location");
		System.out
				.println("U have Given Search element as" + b[elementFoundAt]);

	}
}
